import {message} from "antd"
import {RootState,anyAction} from "../../utils/index"
const initialState:RootState = {
    data:[],
    login_loading:false,
    login_info:{}
}

const reducer = (state = initialState, { type, payload }:any) => {
    let newState = JSON.parse(JSON.stringify(state))
    switch (type) {
        case "LOGIN_INFO":
            message.success(payload.message)
            window.localStorage.setItem("token", JSON.stringify(newState.login_info) )
            return newState
        case "REGISTER_INFO":
            message.success(payload.message)
            return newState

        default:
            return newState
    }
}

export default reducer
